package com.shiroha.user.controller;

import com.shiroha.common.pojo.dto.UserDTO;
import com.shiroha.user.service.ICachedUserService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/us")
@AllArgsConstructor
@Slf4j
public class UserController {

    private final ICachedUserService userService;

    // 新增用户
    @PostMapping("/users")
    public Boolean createUser(@RequestBody UserDTO userDTO) {
        return userService.saveCachedUser(userDTO);
    }

    // 更新用户
    @PutMapping("/us/users")
    public Boolean updateUser(@RequestBody UserDTO userDTO) {
        return userService.updateCachedUser(userDTO);
    }
}
